package com.ebs.md.fxmonitor.marketmonitor.model;

/**
 * Perforce Revision:
 *  $File: //depot/MarketData/fxmonitor/main/src/main/java/com/ebs/md/fxmonitor/marketmonitor/model/AbsSingleFactByTrader.java $
 *  $Revision: #7 $  $Change: 114880 $  $DateTime: 2012/09/11 16:46:48 $  $Author: Arik.Sher $
 */

import com.ebs.md.api.BookSide;
import com.ebs.md.api.Rate;
import com.ebs.md.api.product.PairProduct;


public abstract class AbsSingleFactByTrader
extends               AbsSingleFact
{
	// gened with Eclipse
	private static final long serialVersionUID = -7974518654926212676L;

	protected String floorCode;
	protected String traderId;


	public AbsSingleFactByTrader(String configInstanceName, PairProduct pair, long timestamp, String quoteId, Rate quoteRate, BookSide bookSide
			, String floorCode, String traderId) {
		super(configInstanceName, pair, timestamp, quoteId, quoteRate, bookSide);
		this.floorCode = floorCode;
		this.traderId  = traderId;
	}

	public AbsSingleFactByTrader(String configInstanceName, AbsOBChange obChange) {
		super(configInstanceName, obChange);
		this.floorCode = obChange.getDealCode();
		this.traderId  = obChange.getTraderId();
	}

	public String getFloorCode() {
		return floorCode;
	}

	public String getTraderId() {
		return traderId;
	}

	// gened by eclipse on floorCode, traderId (+super)
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result	+ ((floorCode == null) ? 0 : floorCode.hashCode());
		result = prime * result	+ ((traderId == null) ? 0 : traderId.hashCode());
		return result;
	}

	// gened by eclipse on floorCode, traderId (+super)
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		AbsSingleFactByTrader other = (AbsSingleFactByTrader) obj;
		if (floorCode == null) {
			if (other.floorCode != null)
				return false;
		} else if (!floorCode.equals(other.floorCode))
			return false;
		if (traderId == null) {
			if (other.traderId != null)
				return false;
		} else if (!traderId.equals(other.traderId))
			return false;
		return true;
	}

	
	protected String additionalFields4toString() {
		return  
			  ", floorCode=" + floorCode
			+ ", traderId=" + traderId
			;
	}

}
